/*
 *	View scroller
 * 	Responsible for provifing dynamically scrolling functionality
 */

jt.module('ViewScroller', function(context) {
	
	// useful shorthands
	var canvas = context.canvas,
		settings = context.settings,
		gh = context.settings.grid.h,
		gv = context.settings.grid.v,
		viewport = context.viewport,
		fn = context.fn,
		TWEEN = context.require('TWEEN'),

		winW = window.innerWidth,
 		winH = window.innerHeight,

 		scrollpos = {
 			x: 0,
 			y: 0
 		},

 		tweenMove = new TWEEN.Tween(scrollpos),

 		onUpdate = function() {
 			window.scrollTo(this.x, this.y);
 		};
	/* 	 
	 * Desktop fn
	 */
	
	fn.extend({
	});
	
	return {
		
		events: {
			/*
			 *	Summary: Initialize module event handler
			 */
			init: function() {
				context.log('[ViewScroller] init');
			},

			desktopResize: function() {
				winW = window.innerWidth;
 				winH = window.innerHeight;
			},

			mouseMove: function(e) {

				var position = {
					x: ((e.clientX) / winW) * Math.abs(viewport.offset.right), 
					y: ((e.clientY) / winH) * Math.abs(viewport.offset.bottom)
				} 

				//tweenMove.to(position, 300).onUpdate(onUpdate).start();
				//onUpdate.call(position);
			}
		}
	}
	
});